home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / python-support / python-rdflib / rdflib / sparql / bison / QName.py < prev    next >
Encoding:
Python Source  |  2007-04-04  |  504 b   |  18 lines

  1. from rdflib import URIRef
  2. from rdflib.Identifier import Identifier
  3.  
  4. class QName(Identifier):
  5.     __slots__ = ("localname", "prefix")
  6.     def __new__(cls,value):
  7.         try:
  8.             inst = unicode.__new__(cls,value)
  9.         except UnicodeDecodeError:
  10.             inst = unicode.__new__(cls,value,'utf-8')
  11.  
  12.         inst.prefix,inst.localname = value.split(':')
  13.         return inst
  14.  
  15. class QNamePrefix(Identifier):
  16.     def __init__(self,prefix):
  17.         super(QNamePrefix,self).__init__(prefix)
  18.